import {FilterConditionFormTypeEnum} from "./filterConditionFormTypeEnum";
import {FilterConditionForm} from "./filterConditionForm";
/**
 * Created by Administrator on 2017/4/21.
 */
export class FilterForm {

    filterConditionForms: FilterConditionForm[] = []

    constructor(filterConditionForms: FilterConditionForm[]) {
        this.filterConditionForms = filterConditionForms;
    }

    initSearchData() {
        for (let filterConditionForm of this.filterConditionForms) {
            filterConditionForm.right = undefined
            filterConditionForm.data = undefined
        }
    }


    operateSearchData(): FilterConditionForm[] {
        let tempfilterConditions: FilterConditionForm[] = []
        for (let filterCondition of this.filterConditionForms) {
            if (filterCondition.isUseful()) {
                tempfilterConditions.push(filterCondition.operate())
            }
        }
        // console.log(tempfilterConditions)
        return tempfilterConditions
    }
}

